<style>
    #dictItem-add {
        padding: 20px 25px 25px 0;
    }
    #dictItem-add .layui-treeSelect .ztree li a, .ztree li span {
        margin: 0 0 2px 3px !important;
    }
</style>
<div class="layui-fluid" id="dictItem-add">
    <form class="layui-form" action="" lay-filter="dictItem-add-form">
        <div class="layui-form-item">
            <label class="layui-form-label zzdz-form-item-require">所属字典：</label>
            <div class="layui-input-block">
                <select id="dictId-select" name="dictId"></select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label zzdz-form-item-require">Item名称：</label>
            <div class="layui-input-block">
                <input type="text" name="lable" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label zzdz-form-item-require">Item值：</label>
            <div class="layui-input-block">
                <input type="text" name="value" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label zzdz-form-item">描述：</label>
            <div class="layui-input-block">
                <input type="text" name="description" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label zzdz-form-item">备注：</label>
            <div class="layui-input-block">
                <input type="text" name="remarks" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label zzdz-form-item">排序：</label>
            <div class="layui-input-block">
                <input type="text" name="sort" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item zzdz-hide">
            <button class="layui-btn" lay-submit="" lay-filter="dictItem-add-form-submit" id="submit"></button>
            <button type="reset" class="layui-btn" id="reset"></button>
        </div>
    </form>
</div>

<script>
    layui.use(['zzdz', 'form', 'validate', 'treeSelect', "formSelect"], function () {
        var $ = layui.$,
            zzdz = layui.zzdz,
            layer = layui.layer,
            form = layui.form,
            $view = $('#dictItem-add'),
            treeSelect = layui.treeSelect,
            formSelect = layui.formSelect,
            dictIdSelect = $view.find('#dictId-select'),
            validate = layui.validate;

        form.verify(validate);
        form.render();
        <!-- 自定义下拉选择模块 -->
        formSelect.render(ctx + "common/select/dict", $, $view, form, dictIdSelect);
        treeSelect.render({
            elem: $view.find('#dictItem-add-dict'),
            type: 'get',
            data: ctx + 'dict/select',
            placeholder: '请选择',
            search: false
        });
        form.on('submit(dictItem-add-form-submit)', function (data) {
            zzdz.post(ctx + 'dictItem', data.field, function () {
                layer.closeAll();
                zzdz.alert.success('新增字典-子表成功');
                $('#zzdz-dictItem').find('#query').click();
            });
            return false;
        });
    });
</script>